package net.juantxu.pentaho.launcher.utilidades;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

import org.apache.log4j.Logger;

public class ActualizaHTML{
	static Logger log = Logger.getLogger(ActualizaHTML.class);
   ActualizaHTML(String archivo, String viejo, String nuevo ) {
	   {
	         try
	             {
	             File file = new File(archivo);
	             BufferedReader reader = new BufferedReader(new FileReader(file));
	             String line = "", oldtext = "";
	             while((line = reader.readLine()) != null)
	                 {
	                 oldtext += line + "\r\n";
	             }
	             reader.close();
	             String newtext = oldtext.replaceAll(viejo, nuevo);           
	             FileWriter writer = new FileWriter("extra/index.html");
	             writer.write(newtext);writer.close();
	         }
	         catch (IOException ioe)
	             {
	             ioe.printStackTrace();
	         }
	     }
	  

	   }
   
}